<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app"></div>
  <script src="../01渲染器实现/renderer.js"></script>
  <script src="../02响应式系统/reactiveVue3.js"></script>
  <script src="./index.js"></script>
  <script>
    const App={
      data:reactive({
        counter:0
      }),
      render(){
        return h("div",null,[
          // 这里使用了数据，添加到依赖中
          h("h2",null,`当前计数:${this.data.counter}`),
          h('button',{
            /**
             * 普通函数：button触发事件，this->button 
             * 箭头函数：往上层找，找到render，而调用render的在index.js
             *          rootComponent.render(),实际就是App
             * */
            onClick:()=>{
              this.data.counter++
            }
          },"+1")
        ])
      }
    }
    const app=createApp(App)
    app.mount("#app")
  </script>
</body>
</html>